package week6;

import java.math.BigInteger;

public class Ex57 {
    public static void main(String[] args) {
        int ans = 0;
        BigInteger numerator, denominator;
        BigInteger tempNumerator = BigInteger.ONE, tempDenominator = BigInteger.TWO;
        for (int i = 2; i <= 1000; ++i) {
            tempNumerator = tempNumerator.add(tempDenominator.multiply(BigInteger.valueOf(2)));
            tempDenominator = tempDenominator.xor(tempNumerator);
            tempNumerator = tempDenominator.xor(tempNumerator);
            tempDenominator = tempDenominator.xor(tempNumerator);
            numerator = tempNumerator.add(tempDenominator);
            denominator = tempDenominator;
            if (numerator.toString().length() > denominator.toString().length()) {
                ans++;
            }

        }
        System.out.println(ans);
    }


}
